package com.it.myh;

import java.io.*;

/**
 * @Description: // 类说明，在创建类时要填写
 * @ClassName: Od_0215_04    // 类名，会自动填充
 * @Author: MYH          // 创建者
 * @Date: 2023/2/15 21:54   // 时间
 * @Version: 1.0     // 版本
 */
public class Od_0215_04 {
    public static void main(String[] args) {
        File file = new File("object.dat");
        ObjectInputStream objectInputStream = null;
        Object o = null;
        String s = null;
        try {
            FileInputStream fileInputStream = new FileInputStream(file);
            objectInputStream = new ObjectInputStream(fileInputStream);
            o = objectInputStream.readObject();
            s = (String) o;
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } finally {
            if (objectInputStream != null){
                try {
                    objectInputStream.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
        System.out.println(s);
    }
}
